@(form: Form[User], returnUrl: String, _action: Call = routes.Account.doRegister, _type: String = "account")

@inputText(name: String, args: (Symbol,Any)*) = {
  @tags.inputText(form(name), args :_ *)
}

@inputRadio(name: String) = {
            <input type="radio" name="user.newsletter" value="1" @if(form(name).value == "1") {checked="checked"} />
@Messages("text_yes")
            <input type="radio" name="user.newsletter" value="0" @if(form(name).value == "0") {checked="checked"} />
@Messages("text_no")
}

            @form.errors.map { error =>
              <div class="warning">
                @error.key - @error.message
              </div>
            }
            

  @helper.form(_action, ('id, "register" + _type)) {
    <input type="hidden" name="returnUrl" value="@returnUrl"/>
    <input type="hidden" name="address.id" value="@form("address.id").value"/>
    <input type="hidden" name="address.user_email" value="@form("address.user_email").value"/>
    @if(_type != "update") {
    @if(_type == "account" || _type == "update") {
    <h2>@Messages("text_your_details")</h2>
    } else {
    <h2>@Messages("text_new_customer")</h2>
    }
    <div class="content">
      <table class="form">
        @inputText("firstname", 'autofocus -> "true" /* FIXME: autofocus in PPR */)
        @inputText("lastname")
        @inputText("email")
        @if(_type != "download") {
          @inputText("telephone")
          @inputText("fax")
        }
      </table>
    </div>
    } else {
        <input type="hidden" name="firstname" value="@form("firstname").value"/>
        <input type="hidden" name="lastname" value="@form("lastname").value"/>
        <input type="hidden" name="email" value="@form("email").value"/>
    }
    @if(_type != "download") {
    @if(_type != "update") {
    <h2>@Messages("text_your_address") </h2>
    }
    <div class="content">
      <table class="form">
        @inputText("address.company")
        @inputText("address.address_1")
        @inputText("address.address_2")
        @geonames_autocomplete(form)
      </table>
    </div>
    }
    @if(_type == "account") {
    <h2>@Messages("text_your_password")</h2>
    <div class="content">
      <table class="form">
        @inputText("password", 'type -> "password")
        @inputText("confirm", 'type -> "password")
      </table>
    </div>
    <h2>@Messages("text_newsletter")</h2>
    <div class="content">
      <table class="form">
        <tr>
          <td>@Messages("entry_newsletter")</td>
          <td>@inputRadio("newsletter")</td>
        </tr>
      </table>
    </div>
    }
    @if(false /* TODO: text_agree */) {
    <div class="buttons">
      <div class="right">@Html(Messages("text_agree"))
        <input type="checkbox" name="user.agree" value="1" @if(form("agree").value == "1") {checked="checked"}/>
        <a onclick="$('#register@_type').submit();" class="button"><span>@Messages("button_continue")</span></a></div>
    </div>
    } else {
    <div class="buttons">
      @if(_type == "account") {
      <a onclick="$('#register@_type').submit();" class="button"><span>@Messages("button_continue")</span></a>
      } else {
      <a onclick="updateAddress($('#register@_type'))" class="button"><span>@Messages("button_continue")</span></a>
      }
    </div>
    }
  }
